from typing import Optional, List
from enum import Enum
from pydantic import BaseModel


class StorageTypeEnum(Enum):
    HDFS = 1
    HBase = 2
    MySQL = 3


class StorageScaleEnum(Enum):
    small = 1
    middle = 2
    big = 3


class AddStorageReq(BaseModel):
    storageType: StorageTypeEnum
    storageScale: StorageScaleEnum
    mainNodeMemory: int
    slaveNodeMemory: Optional[int]


class AddStorageRes(BaseModel):
    serviceID: str


class GetStorageListItem(BaseModel):
    id: str
    mainNode: str
    size: int
    mainMemory: int
    slaveMemory: int
    type: int
    time: str


class GetStorageListRes(BaseModel):
    total: int
    item: List[GetStorageListItem]


class DeleteStorageReq(BaseModel):
    serviceID: str


class GetStorageStatusSum(BaseModel):
    total: int
    today: int


class GetStorageStatusItem(BaseModel):
    item: int
    count: int


class GetStorageStatusRes(BaseModel):
    sum: GetStorageStatusSum
    items: List[GetStorageStatusItem]


class GetNodeStatusItem(BaseModel):
    item: str
    ip: str
    count: str


class GetNodeStatusRes(BaseModel):
    data: List[GetNodeStatusItem]


class ScaleStorageReq(BaseModel):
    service_id: str
    #node_id: str
    storage_scale: int


class ScaleStorageRes(BaseModel):
    service_id: str
